<?PHP
    $pp_path="..";
    include_once ($pp_path."/common.php");
?>
<!DOCTYPE HTML>
<html>
<head>
    <link href="/css/jquery-ui-1.10.2.custom.min.css" rel="stylesheet" />
    <style>
        * { font-family: "Dotum", "Dotumche"; font-size: 12px; }
        html { height: 100%; }
        body { padding: 0px; margin: 0px; height: 100%; }

        #apiwrite { width: 100%; }
        #apiwrite table { width: 100%; padding: 0px; border-collapse: collapse; border-top: 2px solid #EEEEEE; border-bottom: 2px solid #EEEEEE; }
        #apiwrite th { height: 30px; width: 200px; border-top: 1px solid #EEEEEE; border-bottom: 1px solid #EEEEEE; color: #CC0000; }
        #apiwrite td { height: 30px; border-top: 1px solid #EEEEEE; border-bottom: 1px solid #EEEEEE; }
        #apiwrite #btn_wrap { width: 100%; text-align: center; padding: 10px 0px; }

        .text { width: 95%; }
        .textarea { width: 95%; height: 100px; resize: none; margin: 5px 0px; }
    </style>
</head>
<body>
    <div id="apiwrite">
        <form id="apiFrm" name="apiFrm">
        <table>
        <tr>
            <th>Project Code</th>
            <td><input type="text" id="p_code" name="p_code" class="text" /></td>
        </tr>
        <tr>
            <th>API Key</th>
            <td><input type="text" id="p_apikey" name="p_apikey" class="text" /></td>
        </tr>
        <tr>
            <th>Project Name</th>
            <td><input type="text" id="p_name" name="p_name" class="text" /></td>
        </tr>
        </table>
        </form>
        <div id="btn_wrap">
            <a id="btn_send" class="btn">SEND</a>
            <a id="btn_cancel" class="btn">CANCEL</a>
        </div>
    </div>
    <script src="/script/jquery-1.9.1.js"></script>
    <script src="/script/jquery-ui-1.10.2.custom.min.js"></script>
    <script>
    var sender=["Choi Chul Ki", "Kim Jung Oh", "Yu Bo Sun", "Lim Hee Suk", "Park Il Kwon", "Kim Yu Hyeon"];
    $(function(){
        $(".btn").button();
        $("#btn_send").click(function(){
            if (!$.trim($("#p_code").val())) {
                alert("Please Insert Project Code");
                $("#p_code").focus();
                return false;
            }

            if (!$.trim($("#p_apikey").val())) {
                alert("Please Insert API Key");
                $("#p_apikey").focus();
                return false;
            }

            if (!$.trim($("#p_name").val())) {
                alert("Please Insert Project Name");
                $("#p_name").focus();
                return false;
            }

            $.ajax({
                url:"/proc/send.proc.php",
                type:"post",
                data:$("#gcmFrm").serialize(),
                dataType:"json",
                success: function(d) {
                    if (d.result) {
                        alert("Success Send\nMove Result Page");
                        window.location.replace("/include/result.inc.php");
                    } else {
                        alert("!!Error!!");
                        return false;
                    }
                }
            });
        });
        $("#btn_cancel").click(function(){
            $("#gcmFrm")[0].reset();
        });
    });
    </script>
</body>
</html>